package com.github.bufan.dubbo.consumer.controller;

import com.github.bufan.dubbo.consumer.HelloServiceConsumer;
import com.github.bufan.dubbo.consumer.util.HttpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class TestController {

    @Autowired
    HelloServiceConsumer helloServiceConsumer;

    @GetMapping("/browserIp")
    public String browserIp(String name, HttpServletRequest request){
        String ip= HttpUtils.getIpAddr(request);
        return helloServiceConsumer.browserIp(ip);
    }
}
